package top.boycharse.common.app;

import android.content.Context;

import androidx.annotation.NonNull;

import top.boycharse.factory.presenter.BaseContract;

public abstract class PresenterFragment<T extends BaseContract.Presenter> extends Fragment implements BaseContract.View<T> {

    protected T mPresenter;

    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
        initPresenter();
    }

    public abstract T initPresenter();

    @Override
    public void showError(int str) {
        Application.showToast(str);
    }

    @Override
    public void showLoading() {
        // TODO 加载loading
    }

    @Override
    public void setPresenter(T presenter) {
        mPresenter = presenter;
    }
}
